<?php

class Back_Model_Mapper_Ressources extends Jnd_Model_Mapper_Abstract
{

    protected $_dict = array(
            "id" => "id_ressources",
            "nom" => "nom",
            "module" => "module"
    );
    
    public function recuperationIdParValeur ($valeur, $champ = "nom")
    {
        $table = $this->_getTable();
        $select = new Zend_Db_Table_Select($table);
        $valeurs = explode(".", $valeur);
        $select->where($this->getDict($champ) . "=?", $valeurs[1]);
        $select->where($this->getDict("module") . "=?", $valeurs[0]);
        $stmt = $select->query();
        $resultat = $stmt->fetch();
        return $resultat[$this->getDict("id")];
    }
}